LRU Cache

Cache 缓存

  1. 记忆
  2. 钱包 - 储物柜 3. 代码模块 CPU Socket https://www.sqlpassion.at/archive/2018/01/06/understanding-the- meltdown-exploit-in-my-own-simple-words/

LRU Cache

  1. Least Recently Used(最近最少使用)
  2. Hash Table + Double LinkedList(哈希表+双向链表)
  3. O(1) get and O(1) set

LFU Cache

  1. LFU - least frequently used(最近最不不常⽤用⻚页⾯面置换算法)
  2. LRU - least recently usd(最近最少使⽤用⻚页⾯面置换算法)

加深阅读

中⽂文⻚页⾯面: https://zh.wikipedia.org/wiki/快取⽂文件置換機制 英⽂文⻚页⾯面: https://en.wikipedia.org/wiki/Cache_replacement_policies

实战题⽬

  1. https://leetcode.com/problems/lru-cache/#/
Last Updated: 9/27/2019, 5:01:51 PM